import {defineStore} from "pinia";
import {ref} from "vue";
import {getUserDetailApi} from "@/api/client/user.ts";

export const useUserInfoStore = defineStore('userInfo', () => {
    const username = ref('')
    const avatar = ref('')
    const phone = ref('')
    async function init() {
        const data = await getUserDetailApi() as any
        username.value = data.username
        avatar.value = data.avatar
        phone.value = data.phone
    }

    return {username, avatar,phone, init}
})